<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateTableRelationsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('table_relations', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('master')->default(0)->nullable()->unsigned()->comment('主表');
            $table->integer('mkey')->default(0)->nullable()->unsigned()->comment('主表主键');
            $table->integer('relations')->default(0)->nullable()->unsigned()->comment('关系');
            $table->integer('slave')->default(0)->nullable()->unsigned()->comment('关系表');
            $table->integer('skey')->default(0)->nullable()->unsigned()->comment('关系表主键');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('table_relations');
    }
}
